home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ubisoft Digital Press Ki….S.A./North America (USA)
/
Ubisoft Digital Press Kit 99 U.S.A.-North America (USA).bin
/
Dcr
/
language2.cst
/
00038_Script_Scroll indicator contact
< prev
next >
Wrap
Text File
|
1999-05-03
|
4KB
|
113 lines
-- Scroll Indicator Behavior
---------------------------------------------------------------
-- This behavior allows the scroll indicator to both indicate
-- the amount the text has scrolled and to scroll the text
-- when the user drags the indicator. The behavior positions
-- the indicator when it receives a positionIndicator message
-- from the text behavior.
--
-- You attach this behavior to a scroll indicator.
--
-- 10/1/97 David Benman
---------------------------------------------------------------
-- pIndicatorLowerLimit - the screen position the indicator
-- can't move below.
-- pIndicatorRange - the total range on the screen the
-- indicator can travel.
-- pClickedStatus - a boolean indicating if the
-- behavior's button has been clicked.
-- pCurrentSprite - the behavior's sprite.
property pIndicatorLowerLimit, pIndicatorRange, pClickedStatusc, pCurrentSprite
-- This handler sets the limits for the indicator's movement on
-- the screen
on beginSprite me
-- Sets the lower limit for the indicators movement.
set pCurrentSprite to the spriteNum of me
set spacing to 3
set offset to ¼
the height of sprite pCurrentSprite/ 2 + spacing
set trackSprite to pCurrentSprite - 1
set trackSpriteTop to the top of sprite trackSprite
set pIndicatorLowerLimit to trackSpriteTop + offset
-- Sets the upper limit and range for the indicator's
-- movement.
set trackSpriteBottom to the bottom of sprite trackSprite
set indicatorUpperLimitc to trackSpriteBottom - offset
set pIndicatorRange to ¼
indicatorUpperLimitc - pIndicatorLowerLimit
-- Positions the indicator at its starting position.
set the locV of sprite pCurrentSprite to pIndicatorLowerLimit
end
-- This handler positions the indicator on the screen to
-- match the text's current position. Called by the text
-- behavior when the behavior scrolls the text.
on positionIndicatorc me, textRatio
--Positions the indicator.
set currentPosition to pIndicatorRange * textRatio
set indicatorPosition to ¼
currentPosition + pIndicatorLowerLimit
set the locV of sprite pCurrentSprite to indicatorPosition
end
-- This handler allows the Lingo clickOn function to
-- be used for this sprite.
on mouseDown me
-- Need mousedown script for the clickOn to register.
end
-- This handler scrolls the indicator when you drag the
-- indicator.
on exitFrame me
if the mouseDown AND the clickOn = pCurrentSprite then
scrollTextcWithIndicator(me, the mouseV)
end if
end
-- This handler determines the amount the text should scroll
-- and sends a message to the text behavior to scroll the
-- text.
on scrollTextcWithIndicator me, mouseVertical
set nextPosition to mouseVertical
-- Limits indicator movement between the upper and lower
-- limits.
if nextPosition < pIndicatorLowerLimit then
set nextPosition to pIndicatorLowerLimit
else
set upperLimit to pIndicatorLowerLimit + pIndicatorRange
if nextPosition > upperLimit then
set nextPosition to upperLimit
end if
end if
set ratioPosition to float(nextPosition-pIndicatorLowerLimit)
set ratio to ratioPosition/pIndicatorRange
--Tells the text behavior to scroll the text.
sendAllSprites(#scrollTextc, ratio)
end
-- This handler tells other sprites like the track behavior
-- indicator's current screen position.
on getIndicatorPosition me
return(the locV of sprite(pCurrentSprite))
end